package com.dwf.dominion;

import java.io.File;
import java.util.Vector;

import android.util.Log;

public class Cards {

	public Vector<Card> cards;
	
	public Cards()
	{
		CardsXMLParser parser = new CardsXMLParser();
		File file = new File("/data/data/com.dwf.dominion/cards.xml");
		parser.Parse(file);
		
		cards = new Vector<Card>();
		try
		{
			//** TODO: probably going to change this to a XML based database file **/
			//				NAME				COST	POTION	SET						 	TYPE					, int buys, int coins, int actions, int cards
			cards.add(new Card("Adventurer",		6,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 0, 0, 0, 0));
			cards.add(new Card("Bureaucrat",		4,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION,Card.Type.ATTACK, Card.Type.ACTION_ATTACK}, 0, 0, 0, 0));
			cards.add(new Card("Cellar",			2,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 0, 0, 1, 0));
			cards.add(new Card("Chancellor",		3,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 0, 2, 0, 0));
			cards.add(new Card("Chapel",			2,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 0, 0, 0, 0));
			cards.add(new Card("Council Room",		5,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 1, 0, 0, 4));
			cards.add(new Card("Feast",				5,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 0, 0, 0, 0));
			cards.add(new Card("Festival",			5,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 1, 2, 2, 0));
			cards.add(new Card("Gardens",			4,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.VICTORY}, 0, 0, 0, 0));
			cards.add(new Card("Laboratory",		5,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 0, 0, 1, 2));
			cards.add(new Card("Library",			5,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 0, 0, 0, 0));
			cards.add(new Card("Market",			5,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 1, 1, 1, 1));
			cards.add(new Card("Militia",			4,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION,Card.Type.ATTACK, Card.Type.ACTION_ATTACK}, 0, 2, 0, 0));
			cards.add(new Card("Mine",				5,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 0, 0, 0, 0));
			cards.add(new Card("Moat",				2,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION,Card.Type.REACTION, Card.Type.ACTION_REACTION}, 0, 0, 0, 2));
			cards.add(new Card("Money Lender",		4,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 0, 0, 0, 0));
			cards.add(new Card("Remodel",			4,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 0, 0, 0, 0));
			cards.add(new Card("Smithy",			4,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 0, 0, 0, 3));
			cards.add(new Card("Spy",				4,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION,Card.Type.ATTACK, Card.Type.ACTION_ATTACK}, 0, 0, 1, 1));
			cards.add(new Card("Thief",				4,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION,Card.Type.ATTACK, Card.Type.ACTION_ATTACK}, 0, 0, 0, 0));
			cards.add(new Card("Throne Room",		4,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 0, 0, 0, 0));
			cards.add(new Card("Village",			3,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 0, 0, 2, 1));
			cards.add(new Card("Witch",				5,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION,Card.Type.ATTACK, Card.Type.ACTION_ATTACK}, 0, 0, 0, 2));
			cards.add(new Card("Woodcutter",		3,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 1, 2, 0, 0));
			cards.add(new Card("Workshop",			3,	false,	Card.Set.Dominion,			new Card.Type[]{Card.Type.ACTION}, 0, 0, 0, 0));
			
//			//				NAME				COST	POTION	SET							isAction? 	isAttack? 	isReaction?	isVictory?	isTreasure?	isDuration?
//			cards.add(new Card("Courtyard",			2,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Pawn",				2,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Secret Chanber",	2,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION, Card.Type.REACTION, Card.Type.ACTION_REACTION}));
//			cards.add(new Card("Great Hall",		3,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION, Card.Type.VICTORY, Card.Type.ACTION_VICTORY}));
//			cards.add(new Card("Masquerade",		3,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Shanty Town",		3,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Steward",			3,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Swindler",			3,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION, Card.Type.ATTACK, Card.Type.ACTION_ATTACK}));
//			cards.add(new Card("Wishing Well",		3,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Baron",				4,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Bridge",			4,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Conspirator",		4,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Copper Smith",		4,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Ironworks",			4,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Mining Villiage",	4,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Scout",				4,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Duke",				5,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.VICTORY}));
//			cards.add(new Card("Minion",			5,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION, Card.Type.ATTACK, Card.Type.ACTION_ATTACK}));
//			cards.add(new Card("Saboteur",			5,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION, Card.Type.ATTACK, Card.Type.ACTION_ATTACK}));
//			cards.add(new Card("Torturer",			5,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION, Card.Type.ATTACK, Card.Type.ACTION_ATTACK}));
//			cards.add(new Card("Trading Post",		5,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Tribute",			5,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Upgrade",			5,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Harem",				6,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.VICTORY, Card.Type.TREASURE, Card.Type.TREASURE_VICTORY}));
//			cards.add(new Card("Nobles",			6,	false,	Card.Set.Intrigue,			new Card.Type[]{Card.Type.ACTION, Card.Type.VICTORY, Card.Type.ACTION_VICTORY}));
//
//			//				NAME				COST	POTION	SET							isAction? 	isAttack? 	isReaction?	isVictory?	isTreasure?	isDuration?
//			cards.add(new Card("Bank",				7,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.TREASURE}));
//			cards.add(new Card("Bishop",			4,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("City",				5,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Contraband",		5,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.TREASURE}));
//			cards.add(new Card("Counting House",	5,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Expand",			7,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Forge",				7,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Goons",				6,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION, Card.Type.VICTORY, Card.Type.ACTION_VICTORY}));
//			cards.add(new Card("Grand Market",		6,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Hoard",				6,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.TREASURE}));
//			cards.add(new Card("Kings Court",		7,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Loan",				3,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.TREASURE}));
//			cards.add(new Card("Mint",				5,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Monument",			4,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Mountebank",		5,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION, Card.Type.ATTACK, Card.Type.ACTION_ATTACK}));
//			cards.add(new Card("Peddler",			81,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Quarry",			4,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.TREASURE}));
//			cards.add(new Card("Rabble",			5,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION, Card.Type.ATTACK, Card.Type.ACTION_ATTACK}));
//			cards.add(new Card("Royal Seal",		5,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.TREASURE}));
//			cards.add(new Card("Talisman",			4,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.TREASURE}));
//			cards.add(new Card("Trade Route",		3,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Vault",				5,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION}));
//			cards.add(new Card("Venture",			5,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.TREASURE}));
//			cards.add(new Card("Watchtower",		3,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION, Card.Type.REACTION, Card.Type.ACTION_REACTION}));
//			cards.add(new Card("Worker's Village",	4,	false,	Card.Set.Prosperity,		new Card.Type[]{Card.Type.ACTION}));
		}
		catch(Exception e)
		{
			Log.d("CARDS_CONTRUCTOR", e.toString());
		}
	}
	
	public Vector<Card> getAllCards()
	{
		return cards;
	}
	
	public Vector<Card> getCategory (Card.Category cat)
	{
		Vector<Card> result = new Vector<Card>();

		for (Card c: cards)
		{
			if (c.isCategory(cat))
			{
				result.add(c);
			}
		}

		return result;
	}
}
